﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.6
// Code is generated on: 02 November 2012 16:44:35
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections;
#if !CF
using System.Runtime.Serialization;
#endif
using System.Data;
using System.Xml.Serialization;
using NetDon.OA.Data;
using NetDon.OA.Data.FactoryClasses;
using NetDon.OA.Data.DaoClasses;
using NetDon.OA.Data.RelationClasses;
using NetDon.OA.Data.HelperClasses;
using NetDon.OA.Data.CollectionClasses;

using SD.LLBLGen.Pro.ORMSupportClasses;

namespace NetDon.OA.Data.EntityClasses
{
	
	// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
	// __LLBLGENPRO_USER_CODE_REGION_END

	/// <summary>
	/// Entity class which represents the entity 'User'. <br/><br/>
	/// 
	/// </summary>
	[Serializable]
	public partial class UserEntity : CommonEntityBase, ISerializable
		// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
		// __LLBLGENPRO_USER_CODE_REGION_END	
	{
		#region Class Member Declarations
		private NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection	_departmentManager;
		private bool	_alwaysFetchDepartmentManager, _alreadyFetchedDepartmentManager;
		private NetDon.OA.Data.CollectionClasses.UserRoleCollection	_userRole;
		private bool	_alwaysFetchUserRole, _alreadyFetchedUserRole;
		private NetDon.OA.Data.CollectionClasses.DepartmentCollection _departmentCollectionViaDepartmentManager;
		private bool	_alwaysFetchDepartmentCollectionViaDepartmentManager, _alreadyFetchedDepartmentCollectionViaDepartmentManager;
		private NetDon.OA.Data.CollectionClasses.RoleCollection _roleCollectionViaUserRole;
		private bool	_alwaysFetchRoleCollectionViaUserRole, _alreadyFetchedRoleCollectionViaUserRole;
		private CompanyEntity _company;
		private bool	_alwaysFetchCompany, _alreadyFetchedCompany, _companyReturnsNewIfNotFound;
		private DepartmentEntity _department;
		private bool	_alwaysFetchDepartment, _alreadyFetchedDepartment, _departmentReturnsNewIfNotFound;
		private PostEntity _post;
		private bool	_alwaysFetchPost, _alreadyFetchedPost, _postReturnsNewIfNotFound;

		
		// __LLBLGENPRO_USER_CODE_REGION_START PrivateMembers
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Statics
		private static Dictionary<string, string>	_customProperties;
		private static Dictionary<string, Dictionary<string, string>>	_fieldsCustomProperties;

		/// <summary>All names of fields mapped onto a relation. Usable for in-memory filtering</summary>
		public static partial class MemberNames
		{
			/// <summary>Member name Company</summary>
			public static readonly string Company = "Company";
			/// <summary>Member name Department</summary>
			public static readonly string Department = "Department";
			/// <summary>Member name Post</summary>
			public static readonly string Post = "Post";
			/// <summary>Member name DepartmentManager</summary>
			public static readonly string DepartmentManager = "DepartmentManager";
			/// <summary>Member name UserRole</summary>
			public static readonly string UserRole = "UserRole";
			/// <summary>Member name DepartmentCollectionViaDepartmentManager</summary>
			public static readonly string DepartmentCollectionViaDepartmentManager = "DepartmentCollectionViaDepartmentManager";
			/// <summary>Member name RoleCollectionViaUserRole</summary>
			public static readonly string RoleCollectionViaUserRole = "RoleCollectionViaUserRole";

		}
		#endregion
		
		/// <summary>Static CTor for setting up custom property hashtables. Is executed before the first instance of this entity class or derived classes is constructed. </summary>
		static UserEntity()
		{
			SetupCustomPropertyHashtables();
		}

		/// <summary>CTor</summary>
		public UserEntity()
		{
			InitClassEmpty(null);
		}


		/// <summary>CTor</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		public UserEntity(System.Guid userId)
		{
			InitClassFetch(userId, null, null);
		}

		/// <summary>CTor</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		public UserEntity(System.Guid userId, IPrefetchPath prefetchPathToUse)
		{
			InitClassFetch(userId, null, prefetchPathToUse);
		}

		/// <summary>CTor</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="validator">The custom validator object for this UserEntity</param>
		public UserEntity(System.Guid userId, IValidator validator)
		{
			InitClassFetch(userId, validator, null);
		}


		/// <summary>Private CTor for deserialization</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		protected UserEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			_departmentManager = (NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection)info.GetValue("_departmentManager", typeof(NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection));
			_alwaysFetchDepartmentManager = info.GetBoolean("_alwaysFetchDepartmentManager");
			_alreadyFetchedDepartmentManager = info.GetBoolean("_alreadyFetchedDepartmentManager");
			_userRole = (NetDon.OA.Data.CollectionClasses.UserRoleCollection)info.GetValue("_userRole", typeof(NetDon.OA.Data.CollectionClasses.UserRoleCollection));
			_alwaysFetchUserRole = info.GetBoolean("_alwaysFetchUserRole");
			_alreadyFetchedUserRole = info.GetBoolean("_alreadyFetchedUserRole");
			_departmentCollectionViaDepartmentManager = (NetDon.OA.Data.CollectionClasses.DepartmentCollection)info.GetValue("_departmentCollectionViaDepartmentManager", typeof(NetDon.OA.Data.CollectionClasses.DepartmentCollection));
			_alwaysFetchDepartmentCollectionViaDepartmentManager = info.GetBoolean("_alwaysFetchDepartmentCollectionViaDepartmentManager");
			_alreadyFetchedDepartmentCollectionViaDepartmentManager = info.GetBoolean("_alreadyFetchedDepartmentCollectionViaDepartmentManager");
			_roleCollectionViaUserRole = (NetDon.OA.Data.CollectionClasses.RoleCollection)info.GetValue("_roleCollectionViaUserRole", typeof(NetDon.OA.Data.CollectionClasses.RoleCollection));
			_alwaysFetchRoleCollectionViaUserRole = info.GetBoolean("_alwaysFetchRoleCollectionViaUserRole");
			_alreadyFetchedRoleCollectionViaUserRole = info.GetBoolean("_alreadyFetchedRoleCollectionViaUserRole");
			_company = (CompanyEntity)info.GetValue("_company", typeof(CompanyEntity));
			if(_company!=null)
			{
				_company.AfterSave+=new EventHandler(OnEntityAfterSave);
			}
			_companyReturnsNewIfNotFound = info.GetBoolean("_companyReturnsNewIfNotFound");
			_alwaysFetchCompany = info.GetBoolean("_alwaysFetchCompany");
			_alreadyFetchedCompany = info.GetBoolean("_alreadyFetchedCompany");
			_department = (DepartmentEntity)info.GetValue("_department", typeof(DepartmentEntity));
			if(_department!=null)
			{
				_department.AfterSave+=new EventHandler(OnEntityAfterSave);
			}
			_departmentReturnsNewIfNotFound = info.GetBoolean("_departmentReturnsNewIfNotFound");
			_alwaysFetchDepartment = info.GetBoolean("_alwaysFetchDepartment");
			_alreadyFetchedDepartment = info.GetBoolean("_alreadyFetchedDepartment");
			_post = (PostEntity)info.GetValue("_post", typeof(PostEntity));
			if(_post!=null)
			{
				_post.AfterSave+=new EventHandler(OnEntityAfterSave);
			}
			_postReturnsNewIfNotFound = info.GetBoolean("_postReturnsNewIfNotFound");
			_alwaysFetchPost = info.GetBoolean("_alwaysFetchPost");
			_alreadyFetchedPost = info.GetBoolean("_alreadyFetchedPost");

			base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
			
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}

		
		/// <summary>Performs the desync setup when an FK field has been changed. The entity referenced based on the FK field will be dereferenced and sync info will be removed.</summary>
		/// <param name="fieldIndex">The fieldindex.</param>
		protected override void PerformDesyncSetupFKFieldChange(int fieldIndex)
		{
			switch((UserFieldIndex)fieldIndex)
			{
				case UserFieldIndex.CompanyId:
					DesetupSyncCompany(true, false);
					_alreadyFetchedCompany = false;
					break;
				case UserFieldIndex.DepartId:
					DesetupSyncDepartment(true, false);
					_alreadyFetchedDepartment = false;
					break;
				case UserFieldIndex.PositionId:
					DesetupSyncPost(true, false);
					_alreadyFetchedPost = false;
					break;
				default:
					base.PerformDesyncSetupFKFieldChange(fieldIndex);
					break;
			}
		}
		
		/// <summary>Gets the inheritance info provider instance of the project this entity instance is located in. </summary>
		/// <returns>ready to use inheritance info provider instance.</returns>
		protected override IInheritanceInfoProvider GetInheritanceInfoProvider()
		{
			return InheritanceInfoProviderSingleton.GetInstance();
		}
		
		/// <summary> Will perform post-ReadXml actions</summary>
		protected override void PostReadXmlFixups()
		{
			_alreadyFetchedDepartmentManager = (_departmentManager.Count > 0);
			_alreadyFetchedUserRole = (_userRole.Count > 0);
			_alreadyFetchedDepartmentCollectionViaDepartmentManager = (_departmentCollectionViaDepartmentManager.Count > 0);
			_alreadyFetchedRoleCollectionViaUserRole = (_roleCollectionViaUserRole.Count > 0);
			_alreadyFetchedCompany = (_company != null);
			_alreadyFetchedDepartment = (_department != null);
			_alreadyFetchedPost = (_post != null);

		}
				
		/// <summary>Gets the relation objects which represent the relation the fieldName specified is mapped on. </summary>
		/// <param name="fieldName">Name of the field mapped onto the relation of which the relation objects have to be obtained.</param>
		/// <returns>RelationCollection with relation object(s) which represent the relation the field is maped on</returns>
		public override RelationCollection GetRelationsForFieldOfType(string fieldName)
		{
			return UserEntity.GetRelationsForField(fieldName);
		}

		/// <summary>Gets the relation objects which represent the relation the fieldName specified is mapped on. </summary>
		/// <param name="fieldName">Name of the field mapped onto the relation of which the relation objects have to be obtained.</param>
		/// <returns>RelationCollection with relation object(s) which represent the relation the field is maped on</returns>
		public static RelationCollection GetRelationsForField(string fieldName)
		{
			RelationCollection toReturn = new RelationCollection();
			switch(fieldName)
			{
				case "Company":
					toReturn.Add(UserEntity.Relations.CompanyEntityUsingCompanyId);
					break;
				case "Department":
					toReturn.Add(UserEntity.Relations.DepartmentEntityUsingDepartId);
					break;
				case "Post":
					toReturn.Add(UserEntity.Relations.PostEntityUsingPositionId);
					break;
				case "DepartmentManager":
					toReturn.Add(UserEntity.Relations.DepartmentManagerEntityUsingUserId);
					break;
				case "UserRole":
					toReturn.Add(UserEntity.Relations.UserRoleEntityUsingUserId);
					break;
				case "DepartmentCollectionViaDepartmentManager":
					toReturn.Add(UserEntity.Relations.DepartmentManagerEntityUsingUserId, "UserEntity__", "DepartmentManager_", JoinHint.None);
					toReturn.Add(DepartmentManagerEntity.Relations.DepartmentEntityUsingDepartId, "DepartmentManager_", string.Empty, JoinHint.None);
					break;
				case "RoleCollectionViaUserRole":
					toReturn.Add(UserEntity.Relations.UserRoleEntityUsingUserId, "UserEntity__", "UserRole_", JoinHint.None);
					toReturn.Add(UserRoleEntity.Relations.RoleEntityUsingRoleId, "UserRole_", string.Empty, JoinHint.None);
					break;

				default:

					break;				
			}
			return toReturn;
		}



		/// <summary> ISerializable member. Does custom serialization so event handlers do not get serialized.
		/// Serializes members of this entity class and uses the base class' implementation to serialize the rest.</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			info.AddValue("_departmentManager", (!this.MarkedForDeletion?_departmentManager:null));
			info.AddValue("_alwaysFetchDepartmentManager", _alwaysFetchDepartmentManager);
			info.AddValue("_alreadyFetchedDepartmentManager", _alreadyFetchedDepartmentManager);
			info.AddValue("_userRole", (!this.MarkedForDeletion?_userRole:null));
			info.AddValue("_alwaysFetchUserRole", _alwaysFetchUserRole);
			info.AddValue("_alreadyFetchedUserRole", _alreadyFetchedUserRole);
			info.AddValue("_departmentCollectionViaDepartmentManager", (!this.MarkedForDeletion?_departmentCollectionViaDepartmentManager:null));
			info.AddValue("_alwaysFetchDepartmentCollectionViaDepartmentManager", _alwaysFetchDepartmentCollectionViaDepartmentManager);
			info.AddValue("_alreadyFetchedDepartmentCollectionViaDepartmentManager", _alreadyFetchedDepartmentCollectionViaDepartmentManager);
			info.AddValue("_roleCollectionViaUserRole", (!this.MarkedForDeletion?_roleCollectionViaUserRole:null));
			info.AddValue("_alwaysFetchRoleCollectionViaUserRole", _alwaysFetchRoleCollectionViaUserRole);
			info.AddValue("_alreadyFetchedRoleCollectionViaUserRole", _alreadyFetchedRoleCollectionViaUserRole);
			info.AddValue("_company", (!this.MarkedForDeletion?_company:null));
			info.AddValue("_companyReturnsNewIfNotFound", _companyReturnsNewIfNotFound);
			info.AddValue("_alwaysFetchCompany", _alwaysFetchCompany);
			info.AddValue("_alreadyFetchedCompany", _alreadyFetchedCompany);
			info.AddValue("_department", (!this.MarkedForDeletion?_department:null));
			info.AddValue("_departmentReturnsNewIfNotFound", _departmentReturnsNewIfNotFound);
			info.AddValue("_alwaysFetchDepartment", _alwaysFetchDepartment);
			info.AddValue("_alreadyFetchedDepartment", _alreadyFetchedDepartment);
			info.AddValue("_post", (!this.MarkedForDeletion?_post:null));
			info.AddValue("_postReturnsNewIfNotFound", _postReturnsNewIfNotFound);
			info.AddValue("_alwaysFetchPost", _alwaysFetchPost);
			info.AddValue("_alreadyFetchedPost", _alreadyFetchedPost);

			
			// __LLBLGENPRO_USER_CODE_REGION_START GetObjectInfo
			// __LLBLGENPRO_USER_CODE_REGION_END
			base.GetObjectData(info, context);
		}
		
		/// <summary> Sets the related entity property to the entity specified. If the property is a collection, it will add the entity specified to that collection.</summary>
		/// <param name="propertyName">Name of the property.</param>
		/// <param name="entity">Entity to set as an related entity</param>
		/// <remarks>Used by prefetch path logic.</remarks>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void SetRelatedEntityProperty(string propertyName, IEntity entity)
		{
			switch(propertyName)
			{
				case "Company":
					_alreadyFetchedCompany = true;
					this.Company = (CompanyEntity)entity;
					break;
				case "Department":
					_alreadyFetchedDepartment = true;
					this.Department = (DepartmentEntity)entity;
					break;
				case "Post":
					_alreadyFetchedPost = true;
					this.Post = (PostEntity)entity;
					break;
				case "DepartmentManager":
					_alreadyFetchedDepartmentManager = true;
					if(entity!=null)
					{
						this.DepartmentManager.Add((DepartmentManagerEntity)entity);
					}
					break;
				case "UserRole":
					_alreadyFetchedUserRole = true;
					if(entity!=null)
					{
						this.UserRole.Add((UserRoleEntity)entity);
					}
					break;
				case "DepartmentCollectionViaDepartmentManager":
					_alreadyFetchedDepartmentCollectionViaDepartmentManager = true;
					if(entity!=null)
					{
						this.DepartmentCollectionViaDepartmentManager.Add((DepartmentEntity)entity);
					}
					break;
				case "RoleCollectionViaUserRole":
					_alreadyFetchedRoleCollectionViaUserRole = true;
					if(entity!=null)
					{
						this.RoleCollectionViaUserRole.Add((RoleEntity)entity);
					}
					break;

				default:

					break;
			}
		}

		/// <summary> Sets the internal parameter related to the fieldname passed to the instance relatedEntity. </summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		/// <param name="fieldName">Name of field mapped onto the relation which resolves in the instance relatedEntity</param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void SetRelatedEntity(IEntity relatedEntity, string fieldName)
		{
			switch(fieldName)
			{
				case "Company":
					SetupSyncCompany(relatedEntity);
					break;
				case "Department":
					SetupSyncDepartment(relatedEntity);
					break;
				case "Post":
					SetupSyncPost(relatedEntity);
					break;
				case "DepartmentManager":
					_departmentManager.Add((DepartmentManagerEntity)relatedEntity);
					break;
				case "UserRole":
					_userRole.Add((UserRoleEntity)relatedEntity);
					break;

				default:

					break;
			}
		}
		
		/// <summary> Unsets the internal parameter related to the fieldname passed to the instance relatedEntity. Reverses the actions taken by SetRelatedEntity() </summary>
		/// <param name="relatedEntity">Instance to unset as the related entity of type entityType</param>
		/// <param name="fieldName">Name of field mapped onto the relation which resolves in the instance relatedEntity</param>
		/// <param name="signalRelatedEntityManyToOne">if set to true it will notify the manytoone side, if applicable.</param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void UnsetRelatedEntity(IEntity relatedEntity, string fieldName, bool signalRelatedEntityManyToOne)
		{
			switch(fieldName)
			{
				case "Company":
					DesetupSyncCompany(false, true);
					break;
				case "Department":
					DesetupSyncDepartment(false, true);
					break;
				case "Post":
					DesetupSyncPost(false, true);
					break;
				case "DepartmentManager":
					base.PerformRelatedEntityRemoval(_departmentManager, relatedEntity, signalRelatedEntityManyToOne);
					break;
				case "UserRole":
					base.PerformRelatedEntityRemoval(_userRole, relatedEntity, signalRelatedEntityManyToOne);
					break;

				default:

					break;
			}
		}

		/// <summary> Gets a collection of related entities referenced by this entity which depend on this entity (this entity is the PK side of their FK fields). These
		/// entities will have to be persisted after this entity during a recursive save.</summary>
		/// <returns>Collection with 0 or more IEntity objects, referenced by this entity</returns>
		public override List<IEntity> GetDependingRelatedEntities()
		{
			List<IEntity> toReturn = new List<IEntity>();


			return toReturn;
		}
		
		/// <summary> Gets a collection of related entities referenced by this entity which this entity depends on (this entity is the FK side of their PK fields). These
		/// entities will have to be persisted before this entity during a recursive save.</summary>
		/// <returns>Collection with 0 or more IEntity objects, referenced by this entity</returns>
		public override List<IEntity> GetDependentRelatedEntities()
		{
			List<IEntity> toReturn = new List<IEntity>();
			if(_company!=null)
			{
				toReturn.Add(_company);
			}
			if(_department!=null)
			{
				toReturn.Add(_department);
			}
			if(_post!=null)
			{
				toReturn.Add(_post);
			}


			return toReturn;
		}
		
		/// <summary> Gets a List of all entity collections stored as member variables in this entity. The contents of the ArrayList is
		/// used by the DataAccessAdapter to perform recursive saves. Only 1:n related collections are returned.</summary>
		/// <returns>Collection with 0 or more IEntityCollection objects, referenced by this entity</returns>
		public override List<IEntityCollection> GetMemberEntityCollections()
		{
			List<IEntityCollection> toReturn = new List<IEntityCollection>();
			toReturn.Add(_departmentManager);
			toReturn.Add(_userRole);

			return toReturn;
		}

		/// <summary> Method which will try to fetch the contents for this entity using a unique constraint. </summary>
		/// <remarks>All contents of the entity is lost.</remarks>
		/// <param name="userName">Value for a field in the UniqueConstraint, which is used to retrieve the contents.</param>
		/// <returns>true if succeeded and the contents is read, false otherwise</returns>
		public bool FetchUsingUCUserName(System.String userName)
		{
			return FetchUsingUCUserName( userName, null, null, null);
		}

		/// <summary> Method which will try to fetch the contents for this entity using a unique constraint. </summary>
		/// <remarks>All contents of the entity is lost.</remarks>
		/// <param name="userName">Value for a field in the UniqueConstraint, which is used to retrieve the contents.</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <returns>true if succeeded and the contents is read, false otherwise</returns>
		public bool FetchUsingUCUserName(System.String userName, IPrefetchPath prefetchPathToUse)
		{
			return FetchUsingUCUserName( userName, prefetchPathToUse, null, null);
		}
	
		/// <summary> Method which will try to fetch the contents for this entity using a unique constraint. </summary>
		/// <remarks>All contents of the entity is lost.</remarks>
		/// <param name="userName">Value for a field in the UniqueConstraint, which is used to retrieve the contents.</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <returns>true if succeeded and the contents is read, false otherwise</returns>
		public bool FetchUsingUCUserName(System.String userName, IPrefetchPath prefetchPathToUse, Context contextToUse)
		{
			return FetchUsingUCUserName( userName, prefetchPathToUse, contextToUse, null);
		}
	
		/// <summary> Method which will try to fetch the contents for this entity using a unique constraint. </summary>
		/// <remarks>All contents of the entity is lost.</remarks>
		/// <param name="userName">Value for a field in the UniqueConstraint, which is used to retrieve the contents.</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>true if succeeded and the contents is read, false otherwise</returns>
		public bool FetchUsingUCUserName(System.String userName, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			try
			{
				OnFetch();
				UserDAO dao = (UserDAO)CreateDAOInstance();
				dao.FetchUserUsingUCUserName(this, base.Transaction, userName, prefetchPathToUse, contextToUse, excludedIncludedFields);
				return (base.Fields.State == EntityState.Fetched);
			}
			finally
			{
				OnFetchComplete();
			}
		}

		

		

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Guid userId)
		{
			return FetchUsingPK(userId, null, null, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Guid userId, IPrefetchPath prefetchPathToUse)
		{
			return FetchUsingPK(userId, prefetchPathToUse, null, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Guid userId, IPrefetchPath prefetchPathToUse, Context contextToUse)
		{
			return Fetch(userId, prefetchPathToUse, contextToUse, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Guid userId, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			return Fetch(userId, prefetchPathToUse, contextToUse, excludedIncludedFields);
		}

		/// <summary> Refetches the Entity from the persistent storage. Refetch is used to re-load an Entity which is marked "Out-of-sync", due to a save action. 
		/// Refetching an empty Entity has no effect. </summary>
		/// <returns>true if Refetch succeeded, false otherwise</returns>
		public override bool Refetch()
		{
			return Fetch(this.UserId, null, null, null);
		}

		/// <summary> Returns true if the original value for the field with the fieldIndex passed in, read from the persistent storage was NULL, false otherwise.
		/// Should not be used for testing if the current value is NULL, use <see cref="TestCurrentFieldValueForNull"/> for that.</summary>
		/// <param name="fieldIndex">Index of the field to test if that field was NULL in the persistent storage</param>
		/// <returns>true if the field with the passed in index was NULL in the persistent storage, false otherwise</returns>
		public bool TestOriginalFieldValueForNull(UserFieldIndex fieldIndex)
		{
			return base.Fields[(int)fieldIndex].IsNull;
		}
		
		/// <summary>Returns true if the current value for the field with the fieldIndex passed in represents null/not defined, false otherwise.
		/// Should not be used for testing if the original value (read from the db) is NULL</summary>
		/// <param name="fieldIndex">Index of the field to test if its currentvalue is null/undefined</param>
		/// <returns>true if the field's value isn't defined yet, false otherwise</returns>
		public bool TestCurrentFieldValueForNull(UserFieldIndex fieldIndex)
		{
			return base.CheckIfCurrentFieldValueIsNull((int)fieldIndex);
		}

				
		/// <summary>Gets a list of all the EntityRelation objects the type of this instance has.</summary>
		/// <returns>A list of all the EntityRelation objects the type of this instance has. Hierarchy relations are excluded.</returns>
		public override List<IEntityRelation> GetAllRelations()
		{
			return new UserRelations().GetAllRelations();
		}


		/// <summary> Retrieves all related entities of type 'DepartmentManagerEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'DepartmentManagerEntity'</returns>
		public NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection GetMultiDepartmentManager(bool forceFetch)
		{
			return GetMultiDepartmentManager(forceFetch, _departmentManager.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'DepartmentManagerEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'DepartmentManagerEntity'</returns>
		public NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection GetMultiDepartmentManager(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiDepartmentManager(forceFetch, _departmentManager.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'DepartmentManagerEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection GetMultiDepartmentManager(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiDepartmentManager(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'DepartmentManagerEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection GetMultiDepartmentManager(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedDepartmentManager || forceFetch || _alwaysFetchDepartmentManager) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_departmentManager.ParticipatesInTransaction)
					{
						base.Transaction.Add(_departmentManager);
					}
				}
				_departmentManager.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_departmentManager.EntityFactoryToUse = entityFactoryToUse;
				}
				_departmentManager.GetMultiManyToOne(null, this, filter);
				_departmentManager.SuppressClearInGetMulti=false;
				_alreadyFetchedDepartmentManager = true;
			}
			return _departmentManager;
		}

		/// <summary> Sets the collection parameters for the collection for 'DepartmentManager'. These settings will be taken into account
		/// when the property DepartmentManager is requested or GetMultiDepartmentManager is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersDepartmentManager(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_departmentManager.SortClauses=sortClauses;
			_departmentManager.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'UserRoleEntity'</returns>
		public NetDon.OA.Data.CollectionClasses.UserRoleCollection GetMultiUserRole(bool forceFetch)
		{
			return GetMultiUserRole(forceFetch, _userRole.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'UserRoleEntity'</returns>
		public NetDon.OA.Data.CollectionClasses.UserRoleCollection GetMultiUserRole(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiUserRole(forceFetch, _userRole.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public NetDon.OA.Data.CollectionClasses.UserRoleCollection GetMultiUserRole(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiUserRole(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual NetDon.OA.Data.CollectionClasses.UserRoleCollection GetMultiUserRole(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedUserRole || forceFetch || _alwaysFetchUserRole) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_userRole.ParticipatesInTransaction)
					{
						base.Transaction.Add(_userRole);
					}
				}
				_userRole.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_userRole.EntityFactoryToUse = entityFactoryToUse;
				}
				_userRole.GetMultiManyToOne(null, this, filter);
				_userRole.SuppressClearInGetMulti=false;
				_alreadyFetchedUserRole = true;
			}
			return _userRole;
		}

		/// <summary> Sets the collection parameters for the collection for 'UserRole'. These settings will be taken into account
		/// when the property UserRole is requested or GetMultiUserRole is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersUserRole(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_userRole.SortClauses=sortClauses;
			_userRole.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'DepartmentEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'DepartmentEntity'</returns>
		public NetDon.OA.Data.CollectionClasses.DepartmentCollection GetMultiDepartmentCollectionViaDepartmentManager(bool forceFetch)
		{
			return GetMultiDepartmentCollectionViaDepartmentManager(forceFetch, _departmentCollectionViaDepartmentManager.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'DepartmentEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public NetDon.OA.Data.CollectionClasses.DepartmentCollection GetMultiDepartmentCollectionViaDepartmentManager(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedDepartmentCollectionViaDepartmentManager || forceFetch || _alwaysFetchDepartmentCollectionViaDepartmentManager) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_departmentCollectionViaDepartmentManager.ParticipatesInTransaction)
					{
						base.Transaction.Add(_departmentCollectionViaDepartmentManager);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_departmentCollectionViaDepartmentManager.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_departmentCollectionViaDepartmentManager.EntityFactoryToUse = entityFactoryToUse;
				}
				_departmentCollectionViaDepartmentManager.GetMulti(filter, GetRelationsForField("DepartmentCollectionViaDepartmentManager"));
				_departmentCollectionViaDepartmentManager.SuppressClearInGetMulti=false;
				_alreadyFetchedDepartmentCollectionViaDepartmentManager = true;
			}
			return _departmentCollectionViaDepartmentManager;
		}

		/// <summary> Sets the collection parameters for the collection for 'DepartmentCollectionViaDepartmentManager'. These settings will be taken into account
		/// when the property DepartmentCollectionViaDepartmentManager is requested or GetMultiDepartmentCollectionViaDepartmentManager is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersDepartmentCollectionViaDepartmentManager(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_departmentCollectionViaDepartmentManager.SortClauses=sortClauses;
			_departmentCollectionViaDepartmentManager.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'RoleEntity'</returns>
		public NetDon.OA.Data.CollectionClasses.RoleCollection GetMultiRoleCollectionViaUserRole(bool forceFetch)
		{
			return GetMultiRoleCollectionViaUserRole(forceFetch, _roleCollectionViaUserRole.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public NetDon.OA.Data.CollectionClasses.RoleCollection GetMultiRoleCollectionViaUserRole(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedRoleCollectionViaUserRole || forceFetch || _alwaysFetchRoleCollectionViaUserRole) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_roleCollectionViaUserRole.ParticipatesInTransaction)
					{
						base.Transaction.Add(_roleCollectionViaUserRole);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_roleCollectionViaUserRole.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_roleCollectionViaUserRole.EntityFactoryToUse = entityFactoryToUse;
				}
				_roleCollectionViaUserRole.GetMulti(filter, GetRelationsForField("RoleCollectionViaUserRole"));
				_roleCollectionViaUserRole.SuppressClearInGetMulti=false;
				_alreadyFetchedRoleCollectionViaUserRole = true;
			}
			return _roleCollectionViaUserRole;
		}

		/// <summary> Sets the collection parameters for the collection for 'RoleCollectionViaUserRole'. These settings will be taken into account
		/// when the property RoleCollectionViaUserRole is requested or GetMultiRoleCollectionViaUserRole is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersRoleCollectionViaUserRole(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_roleCollectionViaUserRole.SortClauses=sortClauses;
			_roleCollectionViaUserRole.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves the related entity of type 'CompanyEntity', using a relation of type 'n:1'</summary>
		/// <returns>A fetched entity of type 'CompanyEntity' which is related to this entity.</returns>
		public CompanyEntity GetSingleCompany()
		{
			return GetSingleCompany(false);
		}

		/// <summary> Retrieves the related entity of type 'CompanyEntity', using a relation of type 'n:1'</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
		/// <returns>A fetched entity of type 'CompanyEntity' which is related to this entity.</returns>
		public virtual CompanyEntity GetSingleCompany(bool forceFetch)
		{
			if( ( !_alreadyFetchedCompany || forceFetch || _alwaysFetchCompany) && !base.IsSerializing && !base.IsDeserializing  && !base.InDesignMode)			
			{
				bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(UserEntity.Relations.CompanyEntityUsingCompanyId);

				CompanyEntity newEntity = new CompanyEntity();
				if(base.ParticipatesInTransaction)
				{
					base.Transaction.Add(newEntity);
				}
				bool fetchResult = false;
				if(performLazyLoading)
				{
					fetchResult = newEntity.FetchUsingPK(this.CompanyId.GetValueOrDefault());
				}
				if(fetchResult)
				{
					if(base.ActiveContext!=null)
					{
						newEntity = (CompanyEntity)base.ActiveContext.Get(newEntity);
					}
					this.Company = newEntity;
				}
				else
				{
					if(_companyReturnsNewIfNotFound)
					{
						if(performLazyLoading || (!performLazyLoading && (_company == null)))
						{
							this.Company = newEntity;
						}
					}
					else
					{
						this.Company = null;
					}
				}
				_alreadyFetchedCompany = fetchResult;
				if(base.ParticipatesInTransaction && !fetchResult)
				{
					base.Transaction.Remove(newEntity);
				}
			}
			return _company;
		}

		/// <summary> Retrieves the related entity of type 'DepartmentEntity', using a relation of type 'n:1'</summary>
		/// <returns>A fetched entity of type 'DepartmentEntity' which is related to this entity.</returns>
		public DepartmentEntity GetSingleDepartment()
		{
			return GetSingleDepartment(false);
		}

		/// <summary> Retrieves the related entity of type 'DepartmentEntity', using a relation of type 'n:1'</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
		/// <returns>A fetched entity of type 'DepartmentEntity' which is related to this entity.</returns>
		public virtual DepartmentEntity GetSingleDepartment(bool forceFetch)
		{
			if( ( !_alreadyFetchedDepartment || forceFetch || _alwaysFetchDepartment) && !base.IsSerializing && !base.IsDeserializing  && !base.InDesignMode)			
			{
				bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(UserEntity.Relations.DepartmentEntityUsingDepartId);

				DepartmentEntity newEntity = new DepartmentEntity();
				if(base.ParticipatesInTransaction)
				{
					base.Transaction.Add(newEntity);
				}
				bool fetchResult = false;
				if(performLazyLoading)
				{
					fetchResult = newEntity.FetchUsingPK(this.DepartId.GetValueOrDefault());
				}
				if(fetchResult)
				{
					if(base.ActiveContext!=null)
					{
						newEntity = (DepartmentEntity)base.ActiveContext.Get(newEntity);
					}
					this.Department = newEntity;
				}
				else
				{
					if(_departmentReturnsNewIfNotFound)
					{
						if(performLazyLoading || (!performLazyLoading && (_department == null)))
						{
							this.Department = newEntity;
						}
					}
					else
					{
						this.Department = null;
					}
				}
				_alreadyFetchedDepartment = fetchResult;
				if(base.ParticipatesInTransaction && !fetchResult)
				{
					base.Transaction.Remove(newEntity);
				}
			}
			return _department;
		}

		/// <summary> Retrieves the related entity of type 'PostEntity', using a relation of type 'n:1'</summary>
		/// <returns>A fetched entity of type 'PostEntity' which is related to this entity.</returns>
		public PostEntity GetSinglePost()
		{
			return GetSinglePost(false);
		}

		/// <summary> Retrieves the related entity of type 'PostEntity', using a relation of type 'n:1'</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
		/// <returns>A fetched entity of type 'PostEntity' which is related to this entity.</returns>
		public virtual PostEntity GetSinglePost(bool forceFetch)
		{
			if( ( !_alreadyFetchedPost || forceFetch || _alwaysFetchPost) && !base.IsSerializing && !base.IsDeserializing  && !base.InDesignMode)			
			{
				bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(UserEntity.Relations.PostEntityUsingPositionId);

				PostEntity newEntity = new PostEntity();
				if(base.ParticipatesInTransaction)
				{
					base.Transaction.Add(newEntity);
				}
				bool fetchResult = false;
				if(performLazyLoading)
				{
					fetchResult = newEntity.FetchUsingPK(this.PositionId.GetValueOrDefault());
				}
				if(fetchResult)
				{
					if(base.ActiveContext!=null)
					{
						newEntity = (PostEntity)base.ActiveContext.Get(newEntity);
					}
					this.Post = newEntity;
				}
				else
				{
					if(_postReturnsNewIfNotFound)
					{
						if(performLazyLoading || (!performLazyLoading && (_post == null)))
						{
							this.Post = newEntity;
						}
					}
					else
					{
						this.Post = null;
					}
				}
				_alreadyFetchedPost = fetchResult;
				if(base.ParticipatesInTransaction && !fetchResult)
				{
					base.Transaction.Remove(newEntity);
				}
			}
			return _post;
		}


		/// <summary> Performs the insert action of a new Entity to the persistent storage.</summary>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool InsertEntity()
		{
			UserDAO dao = (UserDAO)CreateDAOInstance();
			return dao.AddNew(base.Fields, base.Transaction);
		}
		
		/// <summary> Adds the internals to the active context. </summary>
		protected override void AddInternalsToContext()
		{
			_departmentManager.ActiveContext = base.ActiveContext;
			_userRole.ActiveContext = base.ActiveContext;
			_departmentCollectionViaDepartmentManager.ActiveContext = base.ActiveContext;
			_roleCollectionViaUserRole.ActiveContext = base.ActiveContext;
			if(_company!=null)
			{
				_company.ActiveContext = base.ActiveContext;
			}
			if(_department!=null)
			{
				_department.ActiveContext = base.ActiveContext;
			}
			if(_post!=null)
			{
				_post.ActiveContext = base.ActiveContext;
			}


		}


		/// <summary> Performs the update action of an existing Entity to the persistent storage.</summary>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool UpdateEntity()
		{
			UserDAO dao = (UserDAO)CreateDAOInstance();
			return dao.UpdateExisting(base.Fields, base.Transaction);
		}
		
		/// <summary> Performs the update action of an existing Entity to the persistent storage.</summary>
		/// <param name="updateRestriction">Predicate expression, meant for concurrency checks in an Update query</param>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool UpdateEntity(IPredicate updateRestriction)
		{
			UserDAO dao = (UserDAO)CreateDAOInstance();
			return dao.UpdateExisting(base.Fields, base.Transaction, updateRestriction);
		}
	
		/// <summary> Initializes the class with empty data, as if it is a new Entity.</summary>
		/// <param name="validatorToUse">Validator to use.</param>
		protected virtual void InitClassEmpty(IValidator validatorToUse)
		{
			OnInitializing();
			base.Fields = CreateFields();
			base.IsNew=true;
			base.Validator = validatorToUse;

			InitClassMembers();
			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty
			// __LLBLGENPRO_USER_CODE_REGION_END

			OnInitialized();
		}
		
		/// <summary>Creates entity fields object for this entity. Used in constructor to setup this entity in a polymorphic scenario.</summary>
		protected virtual IEntityFields CreateFields()
		{
			return EntityFieldsFactory.CreateEntityFieldsObject(NetDon.OA.Data.EntityType.UserEntity);
		}
		
		/// <summary>Creates a new transaction object</summary>
		/// <param name="levelOfIsolation">The level of isolation.</param>
		/// <param name="name">The name.</param>
		protected override ITransaction CreateTransaction( IsolationLevel levelOfIsolation, string name )
		{
			return new Transaction(levelOfIsolation, name);
		}

		/// <summary>
		/// Creates the ITypeDefaultValue instance used to provide default values for value types which aren't of type nullable(of T)
		/// </summary>
		/// <returns></returns>
		protected override ITypeDefaultValue CreateTypeDefaultValueProvider()
		{
			return new TypeDefaultValue();
		}

		/// <summary>
		/// Gets all related data objects, stored by name. The name is the field name mapped onto the relation for that particular data element. 
		/// </summary>
		/// <returns>Dictionary with per name the related referenced data element, which can be an entity collection or an entity or null</returns>
		public override Dictionary<string, object> GetRelatedData()
		{
			Dictionary<string, object> toReturn = new Dictionary<string, object>();
			toReturn.Add("Company", _company);
			toReturn.Add("Department", _department);
			toReturn.Add("Post", _post);
			toReturn.Add("DepartmentManager", _departmentManager);
			toReturn.Add("UserRole", _userRole);
			toReturn.Add("DepartmentCollectionViaDepartmentManager", _departmentCollectionViaDepartmentManager);
			toReturn.Add("RoleCollectionViaUserRole", _roleCollectionViaUserRole);

			return toReturn;
		}
		

		/// <summary> Initializes the the entity and fetches the data related to the entity in this entity.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="validator">The validator object for this UserEntity</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		protected virtual void InitClassFetch(System.Guid userId, IValidator validator, IPrefetchPath prefetchPathToUse)
		{
			OnInitializing();
			base.Validator = validator;
			InitClassMembers();
			base.Fields = CreateFields();
			bool wasSuccesful = Fetch(userId, prefetchPathToUse, null, null);
			base.IsNew = !wasSuccesful;

			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassFetch
			// __LLBLGENPRO_USER_CODE_REGION_END

			OnInitialized();
		}

		/// <summary> Initializes the class members</summary>
		private void InitClassMembers()
		{
			_departmentManager = new NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection(new DepartmentManagerEntityFactory());
			_departmentManager.SetContainingEntityInfo(this, "User");
			_alwaysFetchDepartmentManager = false;
			_alreadyFetchedDepartmentManager = false;
			_userRole = new NetDon.OA.Data.CollectionClasses.UserRoleCollection(new UserRoleEntityFactory());
			_userRole.SetContainingEntityInfo(this, "User");
			_alwaysFetchUserRole = false;
			_alreadyFetchedUserRole = false;
			_departmentCollectionViaDepartmentManager = new NetDon.OA.Data.CollectionClasses.DepartmentCollection(new DepartmentEntityFactory());
			_alwaysFetchDepartmentCollectionViaDepartmentManager = false;
			_alreadyFetchedDepartmentCollectionViaDepartmentManager = false;
			_roleCollectionViaUserRole = new NetDon.OA.Data.CollectionClasses.RoleCollection(new RoleEntityFactory());
			_alwaysFetchRoleCollectionViaUserRole = false;
			_alreadyFetchedRoleCollectionViaUserRole = false;
			_company = null;
			_companyReturnsNewIfNotFound = true;
			_alwaysFetchCompany = false;
			_alreadyFetchedCompany = false;
			_department = null;
			_departmentReturnsNewIfNotFound = true;
			_alwaysFetchDepartment = false;
			_alreadyFetchedDepartment = false;
			_post = null;
			_postReturnsNewIfNotFound = true;
			_alwaysFetchPost = false;
			_alreadyFetchedPost = false;


			PerformDependencyInjection();
			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
			// __LLBLGENPRO_USER_CODE_REGION_END
			OnInitClassMembersComplete();
		}

		#region Custom Property Hashtable Setup
		/// <summary> Initializes the hashtables for the entity type and entity field custom properties. </summary>
		private static void SetupCustomPropertyHashtables()
		{
			_customProperties = new Dictionary<string, string>();
			_fieldsCustomProperties = new Dictionary<string, Dictionary<string, string>>();

			Dictionary<string, string> fieldHashtable = null;
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("UserId", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("FullName", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("UserName", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Password", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Address", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Phone", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Mobile", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Email", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Type", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("CompanyId", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("DepartId", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("PositionId", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("CreateDate", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("NickName", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Gender", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Birthday", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("UserStatus", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("EmailPassword", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Remarks", fieldHashtable);
		}
		#endregion


		/// <summary> Removes the sync logic for member _company</summary>
		/// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncCompany(bool signalRelatedEntity, bool resetFKFields)
		{
			base.PerformDesetupSyncRelatedEntity( _company, new PropertyChangedEventHandler( OnCompanyPropertyChanged ), "Company", UserEntity.Relations.CompanyEntityUsingCompanyId, true, signalRelatedEntity, "User", resetFKFields, new int[] { (int)UserFieldIndex.CompanyId } );		
			_company = null;
		}
		
		/// <summary> setups the sync logic for member _company</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncCompany(IEntity relatedEntity)
		{
			if(_company!=relatedEntity)
			{		
				DesetupSyncCompany(true, true);
				_company = (CompanyEntity)relatedEntity;
				base.PerformSetupSyncRelatedEntity( _company, new PropertyChangedEventHandler( OnCompanyPropertyChanged ), "Company", UserEntity.Relations.CompanyEntityUsingCompanyId, true, ref _alreadyFetchedCompany, new string[] {  } );
			}
		}

		/// <summary>Handles property change events of properties in a related entity.</summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnCompanyPropertyChanged( object sender, PropertyChangedEventArgs e )
		{
			switch( e.PropertyName )
			{
				default:
					break;
			}
		}

		/// <summary> Removes the sync logic for member _department</summary>
		/// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncDepartment(bool signalRelatedEntity, bool resetFKFields)
		{
			base.PerformDesetupSyncRelatedEntity( _department, new PropertyChangedEventHandler( OnDepartmentPropertyChanged ), "Department", UserEntity.Relations.DepartmentEntityUsingDepartId, true, signalRelatedEntity, "User", resetFKFields, new int[] { (int)UserFieldIndex.DepartId } );		
			_department = null;
		}
		
		/// <summary> setups the sync logic for member _department</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncDepartment(IEntity relatedEntity)
		{
			if(_department!=relatedEntity)
			{		
				DesetupSyncDepartment(true, true);
				_department = (DepartmentEntity)relatedEntity;
				base.PerformSetupSyncRelatedEntity( _department, new PropertyChangedEventHandler( OnDepartmentPropertyChanged ), "Department", UserEntity.Relations.DepartmentEntityUsingDepartId, true, ref _alreadyFetchedDepartment, new string[] {  } );
			}
		}

		/// <summary>Handles property change events of properties in a related entity.</summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnDepartmentPropertyChanged( object sender, PropertyChangedEventArgs e )
		{
			switch( e.PropertyName )
			{
				default:
					break;
			}
		}

		/// <summary> Removes the sync logic for member _post</summary>
		/// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncPost(bool signalRelatedEntity, bool resetFKFields)
		{
			base.PerformDesetupSyncRelatedEntity( _post, new PropertyChangedEventHandler( OnPostPropertyChanged ), "Post", UserEntity.Relations.PostEntityUsingPositionId, true, signalRelatedEntity, "User", resetFKFields, new int[] { (int)UserFieldIndex.PositionId } );		
			_post = null;
		}
		
		/// <summary> setups the sync logic for member _post</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncPost(IEntity relatedEntity)
		{
			if(_post!=relatedEntity)
			{		
				DesetupSyncPost(true, true);
				_post = (PostEntity)relatedEntity;
				base.PerformSetupSyncRelatedEntity( _post, new PropertyChangedEventHandler( OnPostPropertyChanged ), "Post", UserEntity.Relations.PostEntityUsingPositionId, true, ref _alreadyFetchedPost, new string[] {  } );
			}
		}

		/// <summary>Handles property change events of properties in a related entity.</summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnPostPropertyChanged( object sender, PropertyChangedEventArgs e )
		{
			switch( e.PropertyName )
			{
				default:
					break;
			}
		}


		/// <summary> Fetches the entity from the persistent storage. Fetch simply reads the entity into an EntityFields object. </summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		private bool Fetch(System.Guid userId, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			try
			{
				OnFetch();
				IDao dao = this.CreateDAOInstance();
				base.Fields[(int)UserFieldIndex.UserId].ForcedCurrentValueWrite(userId);
				dao.FetchExisting(this, base.Transaction, prefetchPathToUse, contextToUse, excludedIncludedFields);
				return (base.Fields.State == EntityState.Fetched);
			}
			finally
			{
				OnFetchComplete();
			}
		}


		/// <summary> Creates the DAO instance for this type</summary>
		/// <returns></returns>
		protected override IDao CreateDAOInstance()
		{
			return DAOFactory.CreateUserDAO();
		}
		
		/// <summary> Creates the entity factory for this type.</summary>
		/// <returns></returns>
		protected override IEntityFactory CreateEntityFactory()
		{
			return new UserEntityFactory();
		}

		#region Class Property Declarations
		/// <summary> The relations object holding all relations of this entity with other entity classes.</summary>
		public  static UserRelations Relations
		{
			get	{ return new UserRelations(); }
		}
		
		/// <summary> The custom properties for this entity type.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public  static Dictionary<string, string> CustomProperties
		{
			get { return _customProperties;}
		}


		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'DepartmentManager' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathDepartmentManager
		{
			get
			{
				return new PrefetchPathElement(new NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection(),
					(IEntityRelation)GetRelationsForField("DepartmentManager")[0], (int)NetDon.OA.Data.EntityType.UserEntity, (int)NetDon.OA.Data.EntityType.DepartmentManagerEntity, 0, null, null, null, "DepartmentManager", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'UserRole' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathUserRole
		{
			get
			{
				return new PrefetchPathElement(new NetDon.OA.Data.CollectionClasses.UserRoleCollection(),
					(IEntityRelation)GetRelationsForField("UserRole")[0], (int)NetDon.OA.Data.EntityType.UserEntity, (int)NetDon.OA.Data.EntityType.UserRoleEntity, 0, null, null, null, "UserRole", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Department' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathDepartmentCollectionViaDepartmentManager
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.DepartmentManagerEntityUsingUserId;
				intermediateRelation.SetAliases(string.Empty, "DepartmentManager_");
				return new PrefetchPathElement(new NetDon.OA.Data.CollectionClasses.DepartmentCollection(), intermediateRelation,
					(int)NetDon.OA.Data.EntityType.UserEntity, (int)NetDon.OA.Data.EntityType.DepartmentEntity, 0, null, null, GetRelationsForField("DepartmentCollectionViaDepartmentManager"), "DepartmentCollectionViaDepartmentManager", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Role' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathRoleCollectionViaUserRole
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.UserRoleEntityUsingUserId;
				intermediateRelation.SetAliases(string.Empty, "UserRole_");
				return new PrefetchPathElement(new NetDon.OA.Data.CollectionClasses.RoleCollection(), intermediateRelation,
					(int)NetDon.OA.Data.EntityType.UserEntity, (int)NetDon.OA.Data.EntityType.RoleEntity, 0, null, null, GetRelationsForField("RoleCollectionViaUserRole"), "RoleCollectionViaUserRole", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Company' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathCompany
		{
			get
			{
				return new PrefetchPathElement(new NetDon.OA.Data.CollectionClasses.CompanyCollection(),
					(IEntityRelation)GetRelationsForField("Company")[0], (int)NetDon.OA.Data.EntityType.UserEntity, (int)NetDon.OA.Data.EntityType.CompanyEntity, 0, null, null, null, "Company", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Department' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathDepartment
		{
			get
			{
				return new PrefetchPathElement(new NetDon.OA.Data.CollectionClasses.DepartmentCollection(),
					(IEntityRelation)GetRelationsForField("Department")[0], (int)NetDon.OA.Data.EntityType.UserEntity, (int)NetDon.OA.Data.EntityType.DepartmentEntity, 0, null, null, null, "Department", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Post' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathPost
		{
			get
			{
				return new PrefetchPathElement(new NetDon.OA.Data.CollectionClasses.PostCollection(),
					(IEntityRelation)GetRelationsForField("Post")[0], (int)NetDon.OA.Data.EntityType.UserEntity, (int)NetDon.OA.Data.EntityType.PostEntity, 0, null, null, null, "Post", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne);
			}
		}


		/// <summary>Returns the full name for this entity, which is important for the DAO to find back persistence info for this entity.</summary>
		[Browsable(false), XmlIgnore]
		public override string LLBLGenProEntityName
		{
			get { return "UserEntity";}
		}

		/// <summary> The custom properties for the type of this entity instance.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[Browsable(false), XmlIgnore]
		public override Dictionary<string, string> CustomPropertiesOfType
		{
			get { return UserEntity.CustomProperties;}
		}

		/// <summary> The custom properties for the fields of this entity type. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public  static Dictionary<string, Dictionary<string, string>> FieldsCustomProperties
		{
			get { return _fieldsCustomProperties;}
		}

		/// <summary> The custom properties for the fields of the type of this entity instance. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[Browsable(false), XmlIgnore]
		public override Dictionary<string, Dictionary<string, string>> FieldsCustomPropertiesOfType
		{
			get { return UserEntity.FieldsCustomProperties;}
		}

		/// <summary> The UserId property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."UserId"<br/>
		/// Table field type characteristics (type, precision, scale, length): UniqueIdentifier, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, true, false</remarks>
		public virtual System.Guid UserId
		{
			get { return (System.Guid)GetValue((int)UserFieldIndex.UserId, true); }
			set	{ SetValue((int)UserFieldIndex.UserId, value, true); }
		}
		/// <summary> The FullName property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."FullName"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String FullName
		{
			get { return (System.String)GetValue((int)UserFieldIndex.FullName, true); }
			set	{ SetValue((int)UserFieldIndex.FullName, value, true); }
		}
		/// <summary> The UserName property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."UserName"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String UserName
		{
			get { return (System.String)GetValue((int)UserFieldIndex.UserName, true); }
			set	{ SetValue((int)UserFieldIndex.UserName, value, true); }
		}
		/// <summary> The Password property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Password"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 100<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Password
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Password, true); }
			set	{ SetValue((int)UserFieldIndex.Password, value, true); }
		}
		/// <summary> The Address property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Address"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 200<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Address
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Address, true); }
			set	{ SetValue((int)UserFieldIndex.Address, value, true); }
		}
		/// <summary> The Phone property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Phone"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Phone
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Phone, true); }
			set	{ SetValue((int)UserFieldIndex.Phone, value, true); }
		}
		/// <summary> The Mobile property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Mobile"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Mobile
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Mobile, true); }
			set	{ SetValue((int)UserFieldIndex.Mobile, value, true); }
		}
		/// <summary> The Email property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Email"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Email
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Email, true); }
			set	{ SetValue((int)UserFieldIndex.Email, value, true); }
		}
		/// <summary> The Type property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Type"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Type
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.Type, false); }
			set	{ SetValue((int)UserFieldIndex.Type, value, true); }
		}
		/// <summary> The CompanyId property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."CompanyId"<br/>
		/// Table field type characteristics (type, precision, scale, length): UniqueIdentifier, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Guid> CompanyId
		{
			get { return (Nullable<System.Guid>)GetValue((int)UserFieldIndex.CompanyId, false); }
			set	{ SetValue((int)UserFieldIndex.CompanyId, value, true); }
		}
		/// <summary> The DepartId property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."DepartId"<br/>
		/// Table field type characteristics (type, precision, scale, length): UniqueIdentifier, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Guid> DepartId
		{
			get { return (Nullable<System.Guid>)GetValue((int)UserFieldIndex.DepartId, false); }
			set	{ SetValue((int)UserFieldIndex.DepartId, value, true); }
		}
		/// <summary> The PositionId property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."PositionId"<br/>
		/// Table field type characteristics (type, precision, scale, length): UniqueIdentifier, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Guid> PositionId
		{
			get { return (Nullable<System.Guid>)GetValue((int)UserFieldIndex.PositionId, false); }
			set	{ SetValue((int)UserFieldIndex.PositionId, value, true); }
		}
		/// <summary> The CreateDate property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."CreateDate"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.DateTime CreateDate
		{
			get { return (System.DateTime)GetValue((int)UserFieldIndex.CreateDate, true); }
			set	{ SetValue((int)UserFieldIndex.CreateDate, value, true); }
		}
		/// <summary> The NickName property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."NickName"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String NickName
		{
			get { return (System.String)GetValue((int)UserFieldIndex.NickName, true); }
			set	{ SetValue((int)UserFieldIndex.NickName, value, true); }
		}
		/// <summary> The Gender property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Gender"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Gender
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.Gender, false); }
			set	{ SetValue((int)UserFieldIndex.Gender, value, true); }
		}
		/// <summary> The Birthday property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Birthday"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.DateTime> Birthday
		{
			get { return (Nullable<System.DateTime>)GetValue((int)UserFieldIndex.Birthday, false); }
			set	{ SetValue((int)UserFieldIndex.Birthday, value, true); }
		}
		/// <summary> The UserStatus property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."UserStatus"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> UserStatus
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.UserStatus, false); }
			set	{ SetValue((int)UserFieldIndex.UserStatus, value, true); }
		}
		/// <summary> The EmailPassword property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."EmailPassword"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 20<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String EmailPassword
		{
			get { return (System.String)GetValue((int)UserFieldIndex.EmailPassword, true); }
			set	{ SetValue((int)UserFieldIndex.EmailPassword, value, true); }
		}
		/// <summary> The Remarks property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Remarks"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 500<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Remarks
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Remarks, true); }
			set	{ SetValue((int)UserFieldIndex.Remarks, value, true); }
		}

		/// <summary> Retrieves all related entities of type 'DepartmentManagerEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiDepartmentManager()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual NetDon.OA.Data.CollectionClasses.DepartmentManagerCollection DepartmentManager
		{
			get	{ return GetMultiDepartmentManager(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for DepartmentManager. When set to true, DepartmentManager is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time DepartmentManager is accessed. You can always execute
		/// a forced fetch by calling GetMultiDepartmentManager(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchDepartmentManager
		{
			get	{ return _alwaysFetchDepartmentManager; }
			set	{ _alwaysFetchDepartmentManager = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property DepartmentManager already has been fetched. Setting this property to false when DepartmentManager has been fetched
		/// will clear the DepartmentManager collection well. Setting this property to true while DepartmentManager hasn't been fetched disables lazy loading for DepartmentManager</summary>
		[Browsable(false)]
		public bool AlreadyFetchedDepartmentManager
		{
			get { return _alreadyFetchedDepartmentManager;}
			set 
			{
				if(_alreadyFetchedDepartmentManager && !value && (_departmentManager != null))
				{
					_departmentManager.Clear();
				}
				_alreadyFetchedDepartmentManager = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiUserRole()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual NetDon.OA.Data.CollectionClasses.UserRoleCollection UserRole
		{
			get	{ return GetMultiUserRole(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for UserRole. When set to true, UserRole is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time UserRole is accessed. You can always execute
		/// a forced fetch by calling GetMultiUserRole(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchUserRole
		{
			get	{ return _alwaysFetchUserRole; }
			set	{ _alwaysFetchUserRole = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property UserRole already has been fetched. Setting this property to false when UserRole has been fetched
		/// will clear the UserRole collection well. Setting this property to true while UserRole hasn't been fetched disables lazy loading for UserRole</summary>
		[Browsable(false)]
		public bool AlreadyFetchedUserRole
		{
			get { return _alreadyFetchedUserRole;}
			set 
			{
				if(_alreadyFetchedUserRole && !value && (_userRole != null))
				{
					_userRole.Clear();
				}
				_alreadyFetchedUserRole = value;
			}
		}

		/// <summary> Retrieves all related entities of type 'DepartmentEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiDepartmentCollectionViaDepartmentManager()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual NetDon.OA.Data.CollectionClasses.DepartmentCollection DepartmentCollectionViaDepartmentManager
		{
			get { return GetMultiDepartmentCollectionViaDepartmentManager(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for DepartmentCollectionViaDepartmentManager. When set to true, DepartmentCollectionViaDepartmentManager is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time DepartmentCollectionViaDepartmentManager is accessed. You can always execute
		/// a forced fetch by calling GetMultiDepartmentCollectionViaDepartmentManager(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchDepartmentCollectionViaDepartmentManager
		{
			get	{ return _alwaysFetchDepartmentCollectionViaDepartmentManager; }
			set	{ _alwaysFetchDepartmentCollectionViaDepartmentManager = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property DepartmentCollectionViaDepartmentManager already has been fetched. Setting this property to false when DepartmentCollectionViaDepartmentManager has been fetched
		/// will clear the DepartmentCollectionViaDepartmentManager collection well. Setting this property to true while DepartmentCollectionViaDepartmentManager hasn't been fetched disables lazy loading for DepartmentCollectionViaDepartmentManager</summary>
		[Browsable(false)]
		public bool AlreadyFetchedDepartmentCollectionViaDepartmentManager
		{
			get { return _alreadyFetchedDepartmentCollectionViaDepartmentManager;}
			set 
			{
				if(_alreadyFetchedDepartmentCollectionViaDepartmentManager && !value && (_departmentCollectionViaDepartmentManager != null))
				{
					_departmentCollectionViaDepartmentManager.Clear();
				}
				_alreadyFetchedDepartmentCollectionViaDepartmentManager = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiRoleCollectionViaUserRole()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual NetDon.OA.Data.CollectionClasses.RoleCollection RoleCollectionViaUserRole
		{
			get { return GetMultiRoleCollectionViaUserRole(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for RoleCollectionViaUserRole. When set to true, RoleCollectionViaUserRole is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time RoleCollectionViaUserRole is accessed. You can always execute
		/// a forced fetch by calling GetMultiRoleCollectionViaUserRole(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchRoleCollectionViaUserRole
		{
			get	{ return _alwaysFetchRoleCollectionViaUserRole; }
			set	{ _alwaysFetchRoleCollectionViaUserRole = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property RoleCollectionViaUserRole already has been fetched. Setting this property to false when RoleCollectionViaUserRole has been fetched
		/// will clear the RoleCollectionViaUserRole collection well. Setting this property to true while RoleCollectionViaUserRole hasn't been fetched disables lazy loading for RoleCollectionViaUserRole</summary>
		[Browsable(false)]
		public bool AlreadyFetchedRoleCollectionViaUserRole
		{
			get { return _alreadyFetchedRoleCollectionViaUserRole;}
			set 
			{
				if(_alreadyFetchedRoleCollectionViaUserRole && !value && (_roleCollectionViaUserRole != null))
				{
					_roleCollectionViaUserRole.Clear();
				}
				_alreadyFetchedRoleCollectionViaUserRole = value;
			}
		}

		/// <summary> Gets / sets related entity of type 'CompanyEntity'. This property is not visible in databound grids.
		/// Setting this property to a new object will make the load-on-demand feature to stop fetching data from the database, until you set this
		/// property to null. Setting this property to an entity will make sure that FK-PK relations are synchronized when appropriate.</summary>
		/// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSingleCompany()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
		/// same scope. The property is marked non-browsable to make it hidden in bound controls, f.e. datagrids.</remarks>
		[Browsable(false)]
		public virtual CompanyEntity Company
		{
			get	{ return GetSingleCompany(false); }
			set
			{
				if(base.IsDeserializing)
				{
					SetupSyncCompany(value);
				}
				else
				{
					if(value==null)
					{
						if(_company != null)
						{
							_company.UnsetRelatedEntity(this, "User");
						}
					}
					else
					{
						if(_company!=value)
						{
							((IEntity)value).SetRelatedEntity(this, "User");
						}
					}
				}
			}
		}

		/// <summary> Gets / sets the lazy loading flag for Company. When set to true, Company is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Company is accessed. You can always execute
		/// a forced fetch by calling GetSingleCompany(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchCompany
		{
			get	{ return _alwaysFetchCompany; }
			set	{ _alwaysFetchCompany = value; }	
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property Company already has been fetched. Setting this property to false when Company has been fetched
		/// will set Company to null as well. Setting this property to true while Company hasn't been fetched disables lazy loading for Company</summary>
		[Browsable(false)]
		public bool AlreadyFetchedCompany
		{
			get { return _alreadyFetchedCompany;}
			set 
			{
				if(_alreadyFetchedCompany && !value)
				{
					this.Company = null;
				}
				_alreadyFetchedCompany = value;
			}
		}

		/// <summary> Gets / sets the flag for what to do if the related entity available through the property Company is not found
		/// in the database. When set to true, Company will return a new entity instance if the related entity is not found, otherwise 
		/// null be returned if the related entity is not found. Default: true.</summary>
		[Browsable(false)]
		public bool CompanyReturnsNewIfNotFound
		{
			get	{ return _companyReturnsNewIfNotFound; }
			set { _companyReturnsNewIfNotFound = value; }	
		}
		/// <summary> Gets / sets related entity of type 'DepartmentEntity'. This property is not visible in databound grids.
		/// Setting this property to a new object will make the load-on-demand feature to stop fetching data from the database, until you set this
		/// property to null. Setting this property to an entity will make sure that FK-PK relations are synchronized when appropriate.</summary>
		/// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSingleDepartment()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
		/// same scope. The property is marked non-browsable to make it hidden in bound controls, f.e. datagrids.</remarks>
		[Browsable(false)]
		public virtual DepartmentEntity Department
		{
			get	{ return GetSingleDepartment(false); }
			set
			{
				if(base.IsDeserializing)
				{
					SetupSyncDepartment(value);
				}
				else
				{
					if(value==null)
					{
						if(_department != null)
						{
							_department.UnsetRelatedEntity(this, "User");
						}
					}
					else
					{
						if(_department!=value)
						{
							((IEntity)value).SetRelatedEntity(this, "User");
						}
					}
				}
			}
		}

		/// <summary> Gets / sets the lazy loading flag for Department. When set to true, Department is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Department is accessed. You can always execute
		/// a forced fetch by calling GetSingleDepartment(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchDepartment
		{
			get	{ return _alwaysFetchDepartment; }
			set	{ _alwaysFetchDepartment = value; }	
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property Department already has been fetched. Setting this property to false when Department has been fetched
		/// will set Department to null as well. Setting this property to true while Department hasn't been fetched disables lazy loading for Department</summary>
		[Browsable(false)]
		public bool AlreadyFetchedDepartment
		{
			get { return _alreadyFetchedDepartment;}
			set 
			{
				if(_alreadyFetchedDepartment && !value)
				{
					this.Department = null;
				}
				_alreadyFetchedDepartment = value;
			}
		}

		/// <summary> Gets / sets the flag for what to do if the related entity available through the property Department is not found
		/// in the database. When set to true, Department will return a new entity instance if the related entity is not found, otherwise 
		/// null be returned if the related entity is not found. Default: true.</summary>
		[Browsable(false)]
		public bool DepartmentReturnsNewIfNotFound
		{
			get	{ return _departmentReturnsNewIfNotFound; }
			set { _departmentReturnsNewIfNotFound = value; }	
		}
		/// <summary> Gets / sets related entity of type 'PostEntity'. This property is not visible in databound grids.
		/// Setting this property to a new object will make the load-on-demand feature to stop fetching data from the database, until you set this
		/// property to null. Setting this property to an entity will make sure that FK-PK relations are synchronized when appropriate.</summary>
		/// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSinglePost()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
		/// same scope. The property is marked non-browsable to make it hidden in bound controls, f.e. datagrids.</remarks>
		[Browsable(false)]
		public virtual PostEntity Post
		{
			get	{ return GetSinglePost(false); }
			set
			{
				if(base.IsDeserializing)
				{
					SetupSyncPost(value);
				}
				else
				{
					if(value==null)
					{
						if(_post != null)
						{
							_post.UnsetRelatedEntity(this, "User");
						}
					}
					else
					{
						if(_post!=value)
						{
							((IEntity)value).SetRelatedEntity(this, "User");
						}
					}
				}
			}
		}

		/// <summary> Gets / sets the lazy loading flag for Post. When set to true, Post is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Post is accessed. You can always execute
		/// a forced fetch by calling GetSinglePost(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchPost
		{
			get	{ return _alwaysFetchPost; }
			set	{ _alwaysFetchPost = value; }	
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property Post already has been fetched. Setting this property to false when Post has been fetched
		/// will set Post to null as well. Setting this property to true while Post hasn't been fetched disables lazy loading for Post</summary>
		[Browsable(false)]
		public bool AlreadyFetchedPost
		{
			get { return _alreadyFetchedPost;}
			set 
			{
				if(_alreadyFetchedPost && !value)
				{
					this.Post = null;
				}
				_alreadyFetchedPost = value;
			}
		}

		/// <summary> Gets / sets the flag for what to do if the related entity available through the property Post is not found
		/// in the database. When set to true, Post will return a new entity instance if the related entity is not found, otherwise 
		/// null be returned if the related entity is not found. Default: true.</summary>
		[Browsable(false)]
		public bool PostReturnsNewIfNotFound
		{
			get	{ return _postReturnsNewIfNotFound; }
			set { _postReturnsNewIfNotFound = value; }	
		}



		/// <summary> Gets or sets a value indicating whether this entity is a subtype</summary>
		protected override bool LLBLGenProIsSubType
		{
			get { return false;}
		}

		/// <summary> Gets the type of the hierarchy this entity is in. </summary>
		[System.ComponentModel.Browsable(false), XmlIgnore]
		protected override InheritanceHierarchyType LLBLGenProIsInHierarchyOfType
		{
			get { return InheritanceHierarchyType.None;}
		}
		
		/// <summary>Returns the NetDon.OA.Data.EntityType enum value for this entity.</summary>
		[Browsable(false), XmlIgnore]
		public override int LLBLGenProEntityTypeValue 
		{ 
			get { return (int)NetDon.OA.Data.EntityType.UserEntity; }
		}
		#endregion


		#region Custom Entity code
		
		// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Included code

		#endregion
	}
}
